package jdbc.util.CompositeQuery;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.text.SimpleDateFormat;
import org.json.JSONArray;

import com.carstop.model.CarStopDetailVO;
import com.carstop.model.CarStopVO;
import com.member.model.MemberVO;

public class CompositeQueryJsonHandler {

	
	public CompositeQueryJsonHandler() {
		super();
	}
	/*
	private String stop_id;
	private String name;
	private Double stop_longitude;
	private Double stop_latitude;
	private String driver_path_id;
	private Timestamp arrival;
	private Integer distance;
	private Integer fee;
	private Integer maxrider;
	private String member_id;
*/
	public JSONArray toJSONArray(List<CompositeQueryVO> compositequerylist) {
		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		for (CompositeQueryVO compositequery : compositequerylist) {
			String stop_id=compositequery.getStop_id();
			String driver_path_id=compositequery.getDriver_path_id();
			String name=compositequery.getName();
			Double stop_longitude=compositequery.getStop_longitude();
			Double stop_latitude=compositequery.getStop_latitude();
			Integer distance = compositequery.getDistance();
			Timestamp arrival=compositequery.getArrival();
			Integer fee=compositequery.getFee();
			Integer maxrider=compositequery.getMaxrider();
			String member_id=compositequery.getMember_id();
		
				HashMap map = new HashMap();
	
					
				map.put("stop_id", stop_id);
				map.put("driver_path_id", driver_path_id);
				map.put("name", name);
				map.put("stop_longitude", stop_longitude);
				map.put("stop_latitude", stop_latitude);
	
	
			
			map.put("distance", distance);
			map.put("arrival", arrival);
			map.put("fee", fee);
			map.put("maxrider", maxrider);
			map.put("member_id", member_id);

			list.add(map);

		
			
		}
		JSONArray compositequery = new JSONArray(list);
		return compositequery;
	}

	
	
	
	
	
	
	
	
}
